home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
8206
/
8206.xpi
/
content
/
webmail
/
aol.js
next >
Wrap
Text File
|
2010-02-02
|
5KB
|
182 lines
window.addEventListener("load",function(event){aolsig.pageload(event)},false);
window.addEventListener("unload",function(event){aolsig.uninitSig(event)},false);
var aolsig =
{
current: null,
pageload: function (event)
{
try
{
wisestampsig.refreshCallback = aolsig.refreshSignature;
setTimeout(function ()
{
aolsig.init();
},
0);
} catch(e)
{
// WISELOG(e);
}
},
uninitSig: function ()
{
var viewDiv = document.getElementById("ws_view");
if (viewDiv) viewDiv.removeEventListener("DOMNodeInserted", aolsig.composeInserted, false);
var compose = document.getElementById("composeMessage");
if (compose)
{
try
{
this._composeListener = false;
compose.removeEventListener("DOMAttrModified", aolsig.composeModified, false);
} catch(e)
{
}
}
this.uninitView();
},
uninitView: function ()
{
if (this.current && this["uninit" + this.current])
{
this["uninit" + this.current]();
}
},
init: function ()
{
// WISELOG("SetupCompose");
var viewDiv = document.getElementById("ws_view");
// WISELOG("viewDiv: "+viewDiv);
if (viewDiv)
viewDiv.addEventListener("DOMNodeInserted", aolsig.composeInserted, false);
},
get _currentMode()
{
var eles = evaluateXPath(document, "//div[contains(@class,'navItemCurrent')]");
if (eles && eles.length > 0)
{
// WISELOG("eles: "+eles.length);
return eles[0].getAttribute("title");
}
return null;
},
composeInserted: function (event)
{
var match = null;
if (event.target && event.target.id)
{
//WISELOG("inserted: "+event.target.id);
if (event.target.id == "composeMessage")
{
setTimeout(function ()
{
/* let the other inner elements load, too */
// WISELOG("ComposeInserted");
aolsig.setupCompose(event.target);
},
100);
}
}
},
composeModified: function (event)
{
//WISELOG("Compose Modified: "+event);
//WISELOG("Attribute: "+event.attrName);
//WISELOG("previous: "+event.prevValue);
//WISELOG("new: "+event.newValue);
//WISELOG("real: "+event.target.getAttribute(event.attrName));
if (aolsig.iframe && event.attrName == "style")
{
aolsig.insertSignature(aolsig.iframe);
}
},
setupCompose: function (view)
{
if (!this._composeListener)
{
this._composeListener = true;
view.addEventListener("DOMAttrModified", aolsig.composeModified, false);
}
var toolbar = evaluateXPath(document, "//div[@id='composeMessage']//div[@class='containerNode']")[0];
//var toolbar = evaluateXPath(document, "//div[@id='composeMessage']//div[contains(@class,'toolbar')]")[0];
this.addWisestampIcon(toolbar);
var iframes = view.getElementsByTagName("iframe");
var iframe = iframes[0];
this.insertSignature(iframe);
},
addWisestampIcon: function (toolbar)
{
// WISELOG("AddWisestampIcon");
if (!wisestampsig.showButton) return;
try
{
var buttons = evaluateXPath(document, "//div[@class='composeMessage']//div[contains(@class,'wsButton rightBorder')]");
var cancelButton = buttons[buttons.length - 1];
var div = document.createElement("div");
div.setAttribute("id", "ws_widget_WSButton_Foxy");
div.setAttribute("class", "wsButton wsIconButton rightBorder");
div.setAttribute("dojoattachevent", "onclick: _onClick, onmouseover: onMouseOver, onmousedown: onMouseDown, onkeypress: onKeyPress")
div.setAttribute("widgetid", "ws_widgeht_WSButton_Foxy");
div.setAttribute("style", "float: left; height: 24px; width: 32px;");
div.setAttribute("title", "");
var nobr = document.createElement("nobr");
nobr.setAttribute("class", "content");
nobr.setAttribute("dojoattachpoint", "contentNode");
nobr.setAttribute("style", "width: 15px; height: 14px;");
var label = document.createElement("div");
label.setAttribute("class", "label");
label.setAttribute("dojoattachpoint", "contentNode");
label.innerHTML = '<img class="icon"' + 'style="background-image: url(' + "'" + wisestampsig.icon + "'" + '); background-position: 0px 0px;;"' + 'src="chrome://wisestamp/skin/space.png"' + '"/>';
nobr.appendChild(label);
div.appendChild(nobr);
toolbar.insertBefore(div, cancelButton);
wisestampsig.initOptionsIcon(div);
} catch(e)
{
// WISELOG("e: "+e);
}
},
uninitCompose: function ()
{
},
iframeTries: 1,
refreshSignature: function ()
{
wisestampsig.insertSignature(aolsig.iframe, false);
},
insertSignature: function (iframe)
{
this.iframe = iframe;
if (this._currentMode != "Drafts")
{
//this.iframe.addEventListener('load',aolsig.iframeLoad,false);
this.iframeLoad(false);
} else
{
// WISELOG("not inserted because it is a draft")
}
},
iframeLoad: function (event)
{
setTimeout(function ()
{
// WISELOG("iframe load: "+event);
// WISELOG("iframe name: "+aolsig.iframe.getAttribute("name"));
// WISELOG("iframe parent: "+aolsig.iframe.parentNode.id);
wisestampsig.insertSignature(aolsig.iframe, true);
if (event)
{
try
{
//aolsig.iframe.removeEventListener('load',aolsig.iframeLoad,false);
} catch(e)
{}
}
},
!event ? 500 : 0);
}
};